<%@ page language="java"  pageEncoding="UTF-8"%>
<%@ include file="/views/commons/taglibs.jsp" %>
<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<title>众秀众筹</title>
	<meta name="Keywords" content="众筹，众筹网，众筹导航，众筹门户，股权众筹，众筹平台，众筹圈子人，众筹项目，众筹三方
影视众筹，店铺众筹，餐饮众筹，众筹报告，创业众筹，投后管理，项目融资，项目众筹，权力的游戏，冰与火之歌" />
	<meta name="Description" content="汇集各行业高手分析众筹项目，行业问答，众筹资讯。" />
	<meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible" />
	<meta name="renderer" content="webkit"/>
	<link rel="stylesheet" href="<%=path%>/css/bootstrap/3.3.5/css/bootstrap.min.css" />
	<link rel="stylesheet" href="<%=path%>/css/cropper.min.css" />
	<link rel="stylesheet" href="<%=path%>/css/cz.css" />

	<script src="<%=path%>/js/jquery-1.11.0.min.js"></script>
	<script src="<%=path%>/js/plugins/datapicker/bootstrap-datepicker.js"></script>
	<script src="<%=path%>/js/plugins/layer/layer.js"></script>
	<script src="<%=path%>/css/bootstrap/3.3.5/js/bootstrap.min.js"></script>

	<script type="text/javascript" src="<%=path%>/js/slider.js"></script>
	<script type="text/javascript" src="<%=path%>/js/cropper.min.js"></script>
</head>
<body class="gray-bg">
<jsp:include page="/views/commons/header.jsp"></jsp:include>
<div class="container page-single">
	<div class="col-md-12">
		<div class="panel panel-default">
			<div class="panel-heading">
				<h3 class="panel-title">交易编辑</h3>
			</div>
			<div class="panel-body event-create">
				<form class="form-horizontal" id="trade_data_form" action="javascript:insertTradeData()">
					<input type="hidden" name="tradeId" value="${tradeRecord.tradeId}"/>
					<input type="hidden" name="tradeTargetId" value="${tradeRecord.tradeTargetId}"/>
					<input type="hidden" name="tradeType" value="${tradeRecord.tradeType}"/>
					<input type="hidden" name="tradeState" value="${tradeRecord.tradeState}"/>
					<input type="hidden" name="buyUser" value="${tradeRecord.buyUser}"/>
					<input type="hidden" name="saleUser" value="${tradeRecord.saleUser}"/>
					<div class="form-group">
						<label class="col-sm-1 control-label">交易类型</label>
						<div class="col-sm-10">
							<c:choose>
							<c:when test="${tradeRecord.tradeType==1}">拆解查看</c:when>
							<c:when test="${tradeRecord.tradeType==2}">问题提问</c:when>
							<c:when test="${tradeRecord.tradeType==3}">偷看</c:when>
							</c:choose>
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-1 control-label">交易状态</label>
						<div class="col-sm-10">
							<c:choose>
							<c:when test="${tradeRecord.tradeState==1}">购买人付款</c:when>
							<c:when test="${tradeRecord.tradeState==2}">拆解人/回答人收款</c:when>
							</c:choose>
						</div>
					</div>
					
					<c:choose>
						<c:when test="${tradeRecord.tradeType==1}">
							<div class="form-group">
								<label class="col-sm-1 control-label">项目名称</label>
								<div class="col-sm-10">
									<input type="text" class="form-control" readonly="readonly" name="projectName" value="${tradeRecord.projectName}">
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-1 control-label">拆解项序号 <em>*</em></label>
								<div class="col-sm-10">
									<input type="text" class="form-control" placeholder="拆解项序号 ,填写数字 即可" name="itemIndex" value="${tradeRecord.itemIndex}">
								</div>
							</div>
						</c:when>
						<c:when test="${tradeRecord.tradeType==2 || tradeRecord.tradeType==3}">
							<div class="form-group">
								<label class="col-sm-1 control-label">问题描述</label>
								<div class="col-sm-10">
									<textarea  class="form-control" name="questionDetail" readonly="readonly" rows="3" cols="93">${tradeRecord.questionDetail}</textarea>
								</div>
							</div>
						</c:when>
					</c:choose>
					
					<c:choose>
						<c:when test="${tradeRecord.tradeState==1}">
							<div class="form-group">
								<label class="col-sm-1 control-label">购买人</label>
								<div class="col-sm-10">
									<input type="text" class="form-control" placeholder="拆解查看人/提问人/偷看人昵称 " name="buyUserName" value="${tradeRecord.buyUserName}">
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-1 control-label">购买人付款金额</label>
								<div class="col-sm-10">
									<input type="text" class="form-control" placeholder="拆解查看人/提问人/偷看人付款金额 " name="buyAmount" value="${tradeRecord.buyAmount}">
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-1 control-label">拆解人/回答人昵称</label>
								<div class="col-sm-10">
									<input type="text" class="form-control" readonly="readonly" name="saleUserName" value="${tradeRecord.saleUserName}">
								</div>
							</div>
						</c:when>
						<c:when test="${tradeRecord.tradeState==2}">
							<div class="form-group">
								<label class="col-sm-1 control-label">购买人昵称</label>
								<div class="col-sm-10">
									<input type="text" class="form-control" readonly="readonly" name="buyUserName" value="${tradeRecord.buyUserName}">
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-1 control-label">购买人付款金额</label>
								<div class="col-sm-10">
									<input type="text" class="form-control" readonly="readonly" name="buyAmount" value="${tradeRecord.buyAmount}">
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-1 control-label">拆解人/回答人昵称</label>
								<div class="col-sm-10">
									<input type="text" class="form-control" readonly="readonly" name="saleUserName" value="${tradeRecord.saleUserName}">
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-1 control-label">拆解人/回答人收到金额</label>
								<div class="col-sm-10">
									<input type="text" class="form-control" placeholder="拆解人/回答人收到金额 " name="saleAmount" value="${tradeRecord.saleAmount}">
								</div>
							</div>
						</c:when>
					</c:choose>
					
					
					<div class="form-group">
						<div class="col-sm-9 col-sm-offset-2">
							<button  class="btn btn-primary" id="trade_confirm_btn" >提交</button>
						</div>
					</div>
				</form>
			</div>
		</div>
	</div>
</div>

<jsp:include page="/views/commons/footer.jsp"></jsp:include>

<script type="text/javascript">
	
	function insertTradeData(){
		$("#trade_confirm_btn").addClass("disabled").attr("disabled","disabled").val("提交中");
		$.ajax({
			url : path + "/admin/trade/update",
			type : "post",
			dataType : "json",
			data : $("#trade_data_form").serialize(),
			success : function(data)
			{
				if(data.result){
					layer.msg("发布成功",{icon: 1});
					window.close();
				}else{
					layer.msg(data.message,{icon: 2});;
					$("#trade_confirm_btn").removeClass("disabled").removeAttr("disabled").val("提交");
				}
			},error:function(){
				layer.msg("服务器网络繁忙",{icon: 2});
				$("#trade_confirm_btn").removeClass("disabled").removeAttr("disabled").val("提交");
			}
		});
	}
</script>
</body>
</html>